<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>会员登录</title>
    <link rel="stylesheet" href="/AmazeUI/assets/css/amazeui.min.css" type="text/css">
    <link rel="stylesheet" href="/css/dlstyle.css" type="text/css">
    <script language="JavaScript" src="/basic/js/jquery-1.7.min.js"></script>
    <script type="text/javascript">
        function submit() {
            var params =$("#form1").serializeArray();
            var viper={};
            var username;
            var password;
            var type="vip";
            for (var item in params){
                viper[params[item].name]=params[item].value;
            }
            if (viper["username"].length==0){
                alert("请输入用户名");
                return;
            }else{
                username=viper["username"];
            }
            if (viper["password"].length==0){
                alert("密码不得为空");
                return;
            }else{
                password=viper["password"];
            }
            $.ajax({
                url:'/account/login/'+username+'/'+password,
                data:'',
                type:'POST',
                dataType:'json',
                /*
               声明参数位json类型，便于后台接收时可以识别
                */
                headers:{
                    Accept:"application/json",
                    "Content-Type":"application/json"
                },
                processData:false,
                cache:false
            }).done(function (data) {
                var status=data.status;
                var name=data.name;
                var lastLogin=data.lastLogin;
                //alert(status);
                if (status==0){
                    if (lastLogin == null || lastLogin ==""){
                        alert("您好"+name +",恭喜您登陆成功,这是您第一次进入系统。");
                    }else {
                        alert("您好"+name +",恭喜您登陆成功,您的上次登陆时间为"+lastLogin);
                    }
                    window.location.href="/index/all";
                }else if(status==1){
                    alert("信息输入有误，请重新输入！");
                }else if (status == 2){
                    alert("对不起，该用户并未激活，请前往激活");
                }
            });
        }
    </script>
</head>
<body>

<div class="login-boxtitle">
    <a href="home.html"><img alt="logo" src="/images/logobig.png"/>
    </a>
</div>

<div class="login-banner">
    <div class="login-main">
        <div class="login-banner-bg">
            <span></span><img src="/images/big.jpg"/>
        </div>
        <div class="login-box">

            <h3 class="title">登录商城</h3>

            <div class="clear"></div>

            <div class="login-form">
                <form id="form1">

                    <div class="user-name">
                        <label for="user"><i class="am-icon-user"></i>
                        </label> <input type="text" name="username" id="user" placeholder="用户名"/>
                    </div>
                    <div class="user-pass">
                        <label for="password"><i class="am-icon-lock"></i>
                        </label> <input type="password" name="password" id="password" placeholder="请输入密码"/>
                    </div>
                </form>
            </div>

            <div class="login-links">
                <label for="remember-me"><input id="remember-me"
                                                type="checkbox">记住密码</label> <a href="#" class="am-fr">忘记密码</a>


            </div>
            <div class="am-cf">
                <input id="submit" type="button" onclick="javascript:submit()"  value="登 录"
                       class="am-btn am-btn-primary am-btn-sm" >
            </div>
            <div class="partner">

                <h3>
                    <a href="/register.html">注册</a>
                </h3>

            </div>

        </div>
    </div>
</div>


<div class="footer ">

    <div class="footer-bd ">
        <p>
            <a href="# ">关于我们</a> <a href="# ">合作伙伴</a> <a href="# ">联系我们</a> <a
                href="# ">网站地图</a> <em>© 2015-2025 版权所有.</em>
        </p>
    </div>
</div>
</body>

</html>